ArticleDirectory
Nodename, nodevalue, and nodetype contain information about nodes.
Record several common attributes in html dom:
Nodename, nodevalue, and nodetype contain information about nodes.
The nodename attribute contains the
Record several common attributes in html dom:
Nodename, nodevalue, and nodetype contain information about nodes.
The nodename attribute contains the name of a node.
The nodename of the element node is the label name.
The nodename of the
NodeName, nodeValue, and nodeType contain information about nodes.
The nodeName attribute contains the name of a node.
The nodeName of the element node is the label name.The nodeName of the attribute node is the attribute name.The nodeName of the
NodeName, nodeValue, and nodeType contain information about nodes.The nodeName attribute contains the name of a node.The nodeName of the element node is the label name.The nodeName of the attribute node is the attribute name.The nodeName of the text
NodeName, NodeValue, and NodeType contain information about the nodes.
The NodeName property contains the name of a node.
The nodename of the element node is the label name
The nodename of the attribute node is the property name
The nodename of
InstanceGets the node type of the BODY element:Document.body.nodeType;Results:1Definition and usageThe NodeType property returns the node type that returns the specified node as a numeric value.If the node is an element node, the NodeType property
Both XML and Dom have nodes, and each node has the nodetype attribute.
Nodetype
named constant
1
element_node
2
attribute_node
3
text_node
4
cdata_section_node
1. nodename attribute: name of the node.If the node is an element node, the name of the element is returned. In this case, it is equivalent to the tagname attribute. For example, AAAA : returns p.If it is an attribute node, nodename returns the
JS nodeType return typeA friend just asked me a few days ago what is the concept of this js nodeType (as the bottom layer of the browser). In this article, I can explain it to you.
Record several common attributes in html dom:
NodeName,
* Element-1
an HTML document
VaR element = Document. getelementbyid ("h1 ")
Element. nodetype = 1
Element. nodename = h1
Element. nodevalue = NULL
* Text-3
VaR element = Document. getelementbyid ("h1 ")
VaR text = element. firstchild
Text.
This topic describes the nodeName, nodeValue, and nodeType attributes. this topic describes the nodeName, nodeValue, and nodeType attributes in detail.
NodeNameThe attribute contains the name of a node.The nodeName of the element node is the
In Firefox,CodeThe line feed in is also considered as a node of Type 1 and name # text. But we are usually not interested in line breaks in the code. In this case, we can use nodetype to filter out unnecessary elements. You can use the following JS
today when using Childrennodes to operate the DOM, encountered a problem, carefully check the relevant API, record:
NodeName
The NodeName property contains the name of a node. The nodeName of the element node is the label name attribute node
Record several common attributes in html dom:Nodename, nodevalue, and nodetype contain information about nodes.
The nodename attribute contains the name of a node.
The nodename of the element node is the label name.
The nodename of the
Dom node type, which is useful in traversal and can be used to filter nodes that do not care about.
For example:
Function showpageattr () {var divimgshowarea = document. getelementbyid ('divimgshowarea '); var nodes = divimgshowarea. childnodes;
First of all, there are three major nodes in the DOM, namely, element node, text node, attribute nodeELEMENT node: Forms the basis of the DOM. , is the root element in the document structure, representing the entire document, as well as ,,, and so
Definitions and usageThe NodeType property returns the node type of the selected node.
Grammar:Elementnode.nodetype
Node Number:
node Name:
1
Element
2
Attribute
3
Text
4
The NodeName property contains the name of a node.
The nodename of the element node is the label name
The nodename of the attribute node is the property name
The nodename of the text node is always #text
The nodename of the document node is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.